Hash a Block of Data

Command:

Hash a block of data.

Notes:

This command requires the optional RSA licence, error code 67 will be returned if the command is not licenced.

It is the responsibility of the application program to ensure that the amount of data supplied in this command does not cause a buffer overflow.

See: Using the RSA cryptosystem for details of where valid values of the common parameters can be found.

 

Field

Length & Type

Details

COMMAND MESSAGE

Message header

m A

(Subsequently returned to the Host unchanged).

Command code

2 A

Value GM.

Hash identifier

2 N

Identifier of the hash algorithm used to hash the data.

Data length

5 N

Length of the message data to be hashed.

Message data

n B

Data to be hashed.

End message delimiter

1 C

Optional.  Must be present if a message trailer is present. Value X’19.

Message trailer

n A

Optional.  Maximum length 32 characters.

RESPONSE MESSAGE

Message header

m A

Returned to the Host unchanged.

Response code

2 A

Value GN.

Error code

2 N

00 : No error

05 : Invalid hash identifier

15 : Error in input data

80 : Data length error

Hash value

n B

Hash result (length depends on the algorithm used)

End message delimiter

1 C

Present only if present in the command message. Value X’19.

Message trailer

n A

Present only if present in the command message. Maximum length 32 characters.

 

 

 

 

Example

Command Request:

GM0100006<606162636465>

Command  Response:

GN00<A4F684537A7BBE842019F7FC13C882F1B1F9AC3B>